<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>点击按钮之后_获取输入值</title>
  </head>

  <body>
    <div>
      <label>num :</label>
      <input type="text" id="input_num" placeholder="请输入num" />
    </div>
    <div>
      <button type="button" id="button_start">start</button>
    </div>
    <script>
      var num = document.getElementById("input_num");
      var button = document.getElementById("button_start");

      button.addEventListener("click", function () {
        var num_value = num.value;
        if (num_value === "") {
          alert("请输入num");
          return;
        }
        console.log("按钮已被点击, num: " + num_value);
      });
    </script>
  </body>
</html>
